package com.lyb.springbootredisclient.config;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.util.concurrent.Executor;
import com.alibaba.ttl.threadpool.TtlExecutors;

/**
 * @author: lyb  2023/3/18 05:48
 */

@Configuration
public class InterfaceAutoConfiguration {
    @Bean
    public static Executor interfaceAsyncTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setThreadGroupName("hzero");
        executor.setThreadNamePrefix("hzero");
        executor.setMaxPoolSize(1);
        executor.setCorePoolSize(1);
        executor.initialize();
        return TtlExecutors.getTtlExecutor(executor);
    }

}
